"use strict";
	
uk.states.load = {
	preload: function(){
		uk.gui.show_tip_message('Setting...');

		uk.game.load.json('script_rolemap', 'assets/config/roles.json');
		uk.game.load.json('script_cardmap', 'assets/config/cards.json');
	},

	create: function(){
		uk.cache.rolemap = uk.game.cache.getJSON('script_rolemap');
		uk.cache.cardmap = uk.game.cache.getJSON('script_cardmap');
		uk.game.cache.destroy();

		for(var k in uk.cache){
			var cfg = uk.cache[k];
			for(var _k in cfg)
				cfg[_k].id = _k;
		}

		this.download_other_resource();
	},

	download_other_resource:function(){
		uk.game.load.resetLocked=true;
		uk.game.load.image('menubg','assets/gamebg.jpg');
		uk.game.load.image('playbg','assets/ui/bg2.png');
		uk.game.load.image('cardback','assets/cards/00.png');
		uk.game.load.image('cardforce','assets/cards/01.png');
		uk.game.load.image('carddead','assets/cards/02.png');
		uk.game.load.spritesheet('btn_start','assets/ui/btnstart.png',96,128);
		uk.game.load.spritesheet('btn_play','assets/ui/btnplay.png',96,128);
		uk.game.load.spritesheet('cardsign','assets/cards/cardsign.png',32,32);
		
		uk.game.load.image('play.userinfobg0','assets/ui/play/userinfobg0.png');
		uk.game.load.image('play.userinfobg1','assets/ui/play/userinfobg1.png');
		uk.game.load.spritesheet('play.btnfinishround','assets/ui/play/btnfinishround.png',100,72);
	
		for(var i in uk.cache.cardmap){
			var cc = uk.cache.cardmap[i];
			if(cc.id == 0)
				continue;
			uk.game.load.image('card_'+cc.id,'assets/cards/'+cc.id+'.png');
		}
		uk.game.load.onFileComplete.add(this.on_load_file_complete,this);
		uk.game.load.onLoadComplete.add(function(){
			this.game.state.start("menu");
		},this);

		uk.game.load.start();
	},

	on_load_file_complete:function(progress, cacheKey, success, totalLoaded, totalFiles){
		uk.gui.show_tip_message('Loading..'+progress+'%');
	},

	update:function(){
	}
};